<template>
  <div class="guide-entry">
    <div class="background-animation">
      <div class="floating-elements">
        <div class="element element-1">🏥</div>
        <div class="element element-2">💊</div>
        <div class="element element-3">🩺</div>
        <div class="element element-4">📱</div>
        <div class="element element-5">💉</div>
        <div class="element element-6">🩻</div>
      </div>
    </div>
    
    <div class="entry-content">
      <div class="logo-section">
        <div class="logo">
          <img src="/icons/doctor.svg" alt="医疗助手" class="logo-icon">
          <div class="logo-glow"></div>
        </div>
      </div>
      
      <h1 class="entry-title">智慧医疗助手</h1>
      <p class="entry-subtitle">欢迎使用我们的医疗服务平台</p>
      
      <div class="entry-options">
        <button class="entry-btn primary" @click="startGuide">
          <span class="btn-icon">🎯</span>
          <span class="btn-text">开始引导</span>
        </button>
        <button class="entry-btn secondary" @click="skipGuide">
          <span class="btn-icon">⚡</span>
          <span class="btn-text">跳过引导</span>
        </button>
      </div>
      
      <div class="entry-info">
        <div class="info-card">
          <div class="info-icon">💡</div>
          <p>首次使用建议完成引导，了解应用功能</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { onMounted } from 'vue'

const router = useRouter()

onMounted(() => {
  // 引导入口页面挂载时，总是显示引导选择
  // 只有在用户明确选择跳过引导后，才会在下次访问时直接跳转到登录页面
  console.log('引导入口页面已加载')
  
  // 临时清除引导完成状态，确保能看到引导页（测试用）
  // localStorage.removeItem('guideCompleted')
})

const startGuide = () => {
  // 清除之前的引导完成状态，确保可以重新开始引导
  localStorage.removeItem('guideCompleted')
  console.log('开始引导，已清除引导完成状态')
  router.push('/guide')
}

const skipGuide = () => {
  // localStorage.setItem('guideCompleted', 'true')  // 临时注释，测试用
  router.push('/login')
}
</script>

<style scoped lang="scss">
.guide-entry {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: white;
  position: relative;
  overflow: hidden;
}

.background-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.floating-elements {
  position: relative;
  width: 100%;
  height: 100%;
}

.element {
  position: absolute;
  font-size: 24px;
  opacity: 0.3;
  animation: float 6s ease-in-out infinite;
  
  &.element-1 {
    top: 15%;
    left: 10%;
    animation-delay: 0s;
  }
  
  &.element-2 {
    top: 25%;
    right: 15%;
    animation-delay: 1s;
  }
  
  &.element-3 {
    top: 60%;
    left: 5%;
    animation-delay: 2s;
  }
  
  &.element-4 {
    top: 70%;
    right: 10%;
    animation-delay: 3s;
  }
  
  &.element-5 {
    top: 40%;
    left: 20%;
    animation-delay: 4s;
  }
  
  &.element-6 {
    top: 50%;
    right: 25%;
    animation-delay: 5s;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0.3;
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
    opacity: 0.6;
  }
}

.entry-content {
  max-width: 450px;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo-section {
  margin-bottom: 30px;
}

.logo {
  position: relative;
  display: inline-block;
}

.logo-icon {
  width: 80px;
  height: 80px;
  filter: brightness(0) invert(1);
  position: relative;
  z-index: 2;
  animation: pulse 2s ease-in-out infinite;
}

.logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  animation: glow 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes glow {
  0%, 100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.entry-title {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  background: linear-gradient(45deg, #ffffff, #f0f0f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.entry-subtitle {
  font-size: 20px;
  opacity: 0.95;
  margin-bottom: 50px;
  font-weight: 300;
  letter-spacing: 0.5px;
}

.entry-options {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 40px;
}

.entry-btn {
  padding: 18px 32px;
  border: none;
  border-radius: 30px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.entry-btn.primary {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  color: #667eea;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  
  &:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
    background: linear-gradient(135deg, #ffffff 0%, #e9ecef 100%);
  }
  
  &:active {
    transform: translateY(-1px);
  }
}

.entry-btn.secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  
  &:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  }
}

.btn-icon {
  font-size: 20px;
  transition: transform 0.3s ease;
}

.btn-text {
  transition: transform 0.3s ease;
}

.entry-btn:hover .btn-icon {
  transform: scale(1.1);
}

.entry-btn.primary:hover .btn-text {
  transform: translateX(2px);
}

.entry-info {
  opacity: 0.9;
}

.info-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  
  &:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  }
}

.info-icon {
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.info-card p {
  font-size: 15px;
  margin: 0;
  font-weight: 500;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .entry-content {
    padding: 0 20px;
  }
  
  .entry-title {
    font-size: 32px;
  }
  
  .entry-subtitle {
    font-size: 18px;
  }
  
  .entry-btn {
    padding: 16px 28px;
    font-size: 16px;
  }
  
  .logo-icon {
    width: 70px;
    height: 70px;
  }
  
  .logo-glow {
    width: 90px;
    height: 90px;
  }
}

@media (max-width: 480px) {
  .entry-title {
    font-size: 28px;
  }
  
  .entry-subtitle {
    font-size: 16px;
  }
  
  .entry-btn {
    padding: 14px 24px;
    font-size: 15px;
  }
  
  .info-card {
    padding: 14px 16px;
  }
  
  .info-card p {
    font-size: 14px;
  }
  
  .logo-icon {
    width: 60px;
    height: 60px;
  }
  
  .logo-glow {
    width: 80px;
    height: 80px;
  }
}
</style> 